﻿using System;

namespace RESTController.Lib
{
    internal class Check
    {
        public static void ArgumentFollowsRule<T>(T argument, Predicate<T> rule, string exceptionMessage)
        {
            ArgumentNotNull(rule, "rule");
            if (!rule(argument))
            {
                throw new ArgumentException(exceptionMessage);
            }
        }

        public static void ArgumentNotNull(object argument, string argumentName)
        {
            if (argument == null)
            {
                throw new ArgumentNullException(argumentName);
            }
        }
    }
}
